﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XZL.GM.Dal;

namespace XZL.GM.Bll
{
   public  class BannerInfoBiz
    {
        /// <summary>
        /// 获取首页列表
        /// </summary>
        /// <param name="BannerID"></param>
        /// <returns></returns>
       public static List<Proc_BannerInfo_SelectListResult> GetBannerList(string bannerName, int pageIndex, int pageSize, ref int? pageCount)
       {
       
        XZL_GMDataContext db = new XZL_GMDataContext();
        return  db.Proc_BannerInfo_SelectList(bannerName, pageIndex, pageSize, ref pageCount).ToList();

       }


        /// <summary>
        /// 获取首页信息
        /// </summary>
        /// <param name="BannerID"></param>
        /// <returns></returns>
        
       public static Proc_Banner_SelectInfoResult GetBannerInfo(int bannerID)
       {
        XZL_GMDataContext db = new XZL_GMDataContext();

        return db.Proc_Banner_SelectInfo(bannerID).FirstOrDefault(); 
       }




        /// <summary>
        /// 添加首页
        /// </summary>
       public static bool BannerAddition(string bannerName, string bannerLink, string bannerImg, int sort, int status)
       {
           XZL_GMDataContext db = new XZL_GMDataContext();

           int i = db.Proc_BannerInfo_Addition(bannerName, bannerLink, bannerImg, sort,status);

           return true;
       }



        /// <summary>
       /// 编辑首页
        /// </summary>
        /// <param name="BannerID">首页ID</param>
        /// <returns>    </returns>
       public static bool BannerUpdate(int bannerID,string bannerName, string bannerLink, string bannerImg, int sort,int status)
       {

           XZL_GMDataContext db = new XZL_GMDataContext();

           int i = db.Proc_BannerInfo_Update(bannerID, bannerName, bannerLink, bannerImg, sort, status);

           return true;
       }

        /// <summary>
        /// 删除首页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
       public static bool DeleteBanner(int bannerID)
       {
           XZL_GMDataContext db = new XZL_GMDataContext();
           db.Proc_Banner_Delete(bannerID);
           return true;     
       }

    }
}
